package cn.bellychang.leetcode.question075;

import java.util.PriorityQueue;

/**
 * @author ChangLiang
 * @date 2021/3/18
 */
public class Solution2 {

    public void sortColors(int[] nums) {

        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(nums.length);

        for (int num : nums) {
            priorityQueue.add(num);
        }

        for (int i = 0; i < nums.length; i++) {
            nums[i] = priorityQueue.poll();
        }
    }
}
